package com.aiwhose.aiwhosecore.bean;

import cn.dev33.satoken.stp.StpUtil;
import com.mybatisflex.annotation.Column;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseEntity {

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @Column(onInsertValue = "now()")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    @Column(onUpdateValue = "now()", onInsertValue = "now()")
    private LocalDateTime updateTime;
    /**
     * 创建者
     */
    @Schema(description = "创建者")
    private String createBy = (String) StpUtil.getTokenInfo().loginId;
    /**
     * 更新人
     */
    @Schema(description = "更新人")
    private String updateBy = (String) StpUtil.getTokenInfo().loginId;

    /**
     * 删除标识，0 表示未删除，1 表示已删除
     */
    @Column(isLogicDelete = true)
    @Schema(description = "删除标识，0 表示未删除，1 表示已删除")
    private Integer deleted;
}
